from . import views
from django.views.generic import RedirectView

from django.urls import re_path as url
from django.contrib import admin
from django.urls import path
from .views import download_image,download_video

app_name = 'app1_name'  # 关键是这行，这样对不同app下相同名称的url就可以进行区分了。{% url 'app1:inserpath' %}

image_upload = views.ImageViewSet.as_view(
    {
        'post': 'create',
        'get' : 'list'
    })

video_upload = views.VideoViewSet.as_view(
    {
        'post': 'create',
        'get' : 'list',
        'delete': 'destroy'
    })

urlpatterns = [
    # 重定向
    path('uploadimage/', image_upload),
    path('uploadvideo/', video_upload),
    path('downloadimage/', download_image, name='download_image'),
    path('downloadvideo/', download_video, name='download_video'),
]